package com.trace.meat.config;

import com.trace.meat.interceptor.TokenInterceptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
@Configuration
public class WebAppConfig implements WebMvcConfigurer {
    //@Autowired
    //private CROSInterceptor crosInterceptor;

    @Autowired
    private TokenInterceptor tokenInterceptor;

    @Override
    public void addInterceptors(InterceptorRegistry registry){
        //registry.addInterceptor(crosInterceptor).addPathPatterns("/**");   // 跨域拦截器
        registry.addInterceptor(tokenInterceptor).addPathPatterns("/**");  // token 验证拦截器
    }

}
